<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../css/mui.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/html-base.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/public-train.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/signup.css"/>
    <script type="text/javascript" src="../../script/newresize.js"></script>
    <script type="text/javascript" src="../../script/mui.min.js"></script>
    <script type="text/javascript" src="../../script/PayTreasurePay.js"></script>
</head>
<body>
<header class="header fix-header">
    <a class="backbtn" onclick="backClick();"></a>
    <h1 class="mui-title">订单</h1>
    <a class="icon-close" onclick="backClick();"></a>
</header>
<div class="signcontainer">
    <div class="signtopinfo">
        <h1><span id="course_name">货运代理师资培训班</span> <span class="price-txt"
                                                          style="position: absolute;top: 50%;right: 0.4rem;margin-top: -0.24rem;"
                                                          id="course_fee">￥12800.00</span></h1>
        <p><span>主讲人：</span><span id="teachername">祁振国</span> <span style="padding-left:0.4rem;"><span
                id="course_period">17</span>课时</span></p>
    </div>
    <div class="signform">
        <form>
            <div class="signform-cont">
                <div class="signinfo-title">
                    <span>支付方式</span><span style="font-size: 0.36rem;color: #999;">（可以选择任意支付方式）</span>
                </div>
                <div class="signpaycont">
                    <ul>
                        <li class="item">
                            <div class="payicon"><p><img src="../../image/payicon_zfb.png"/></p></div>
                            <div class="paytxt">
                                <label for="pay-zfb">支付宝支付</label>
                                <input type="radio" name="pay" id="pay-zfb" value="2" class="pay-radio"/>
                            </div>
                        </li>
                        <li class="item">
                            <div class="payicon"><p><img src="../../image/payicon_qb.png"/></p></div>
                            <div class="paytxt" style="border-bottom: 0;">
                                <label for="pay-qb">线下支付</label>
                                <input type="radio" name="pay" id="pay-qb" value="1" class="pay-radio"/>
                            </div>
                        </li>
                        <!-- <li class="item">
                            <div class="payicon"><p><img src="../../image/payicon_yh.png"/></p></div>
                            <div class="paytxt">
                                <label for="pay-yh">工商银行储蓄卡</label>
                                <input type="radio" name="pay" id="pay-yh" value=""  class="pay-radio"/>
                            </div>
                        </li> -->
                    </ul>
                </div>
            </div>
            <div class="signform-cont">
                <div class="signinfo-title2">
                    <span>购买后可在（学习）区查看</span>
                </div>
            </div>
        </form>
    </div>
</div>
<div class="confirmpay" onclick="onPayClick()">确认支付</div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/jquery.min.js"></script>
<script type="text/javascript" src="../../script/MD5.js"></script>
<script type="text/javascript" src="../../script/requestTool.js"></script>
<script type="text/javascript" src="../../script/timeStampTool.js"></script>
<script type="text/javascript" src="../../script/manager/promptManager.js"></script>
<script type="text/javascript" src="../../script/utils/payUtils.js"></script>

<script type="text/javascript">
    var pay_id = null;
    apiready = function () {
        setupPageData();
        getOrderInfo();
    };

    function setupPageData() {
        var courseData = api.pageParam;
        console.log(JSON.stringify(courseData));
        var course_name = courseData.course_name;
        $('#course_name').text(course_name);
        var course_fee = courseData.course_fee;
        $('#course_fee').text('￥' + course_fee);
        var teachername = courseData.teachername;
        $('#teachername').text(teachername);
        var course_period = courseData.course_period;
        $('#course_period').text(course_period);
    }

    function backClick() {
        api.closeWin();
    }

    function onPayClick() {
        var radioValue = $("input[type='radio']:checked").val();
        if (radioValue == undefined) {
            api.toast({
                msg: '请选择支付方式'
            });
            return;
        }
        pay(radioValue,pay_id);
    }

    function getOrderInfo() {
        var params = {
            link_id: api.pageParam.id,
            category_id: 112
        };
        console.log("link_id:" + api.pageParam.id);
        cfnetppPOST(url_getOrderInfo, params, false, function (data, status) {
            if (status == 'success') {
                if (data.code == 200) {
                    pay_id = data.data;
                }
            }
        });
    }

</script>
</html>